package gouhuo.allbugs.top.service;

import com.baomidou.mybatisplus.extension.service.IService;
import gouhuo.allbugs.top.model.domain.Team;
import gouhuo.allbugs.top.model.domain.UserTeam;
import gouhuo.allbugs.top.model.request.team.TeamJoinRequest;
import gouhuo.allbugs.top.model.request.team.TeamListRequest;
import gouhuo.allbugs.top.model.request.team.TeamQuitRequest;
import gouhuo.allbugs.top.model.request.team.TeamUpdateRequest;
import gouhuo.allbugs.top.model.vo.TeamUserVO;
import gouhuo.allbugs.top.model.vo.UserVO;

import java.util.List;

/**
 * @author 15294780204
 * @description 针对表【team(队伍)】的数据库操作Service
 * @createDate 2023-03-06 18:18:51
 */
public interface TeamService extends IService<Team> {

    /**
     * 创建队伍
     *
     * @param team
     * @param loginUser
     * @return
     */
    long addTeam(Team team, UserVO loginUser);

    /**
     * 删除(解散)队伍
     *
     * @param id
     * @param loginUser
     * @return
     */
    boolean deleteTeam(long id, UserVO loginUser);

    /**
     * 更新队伍
     */
    boolean updateTeam(TeamUpdateRequest teamUpdateRequest, UserVO loginUser);

    /**
     * 加入队伍
     *
     * @param teamJoinRequest
     * @return
     */
    boolean joinTeam(TeamJoinRequest teamJoinRequest, UserVO loginUser);

    /**
     * 退出队伍
     *
     * @param teamQuitRequest
     * @param loginUser
     * @return
     */
    boolean quitTeam(TeamQuitRequest teamQuitRequest, UserVO loginUser);

    /**
     * 将已加入队伍的人数返回给前端,第三个变量控制isJoin是否为ture(仅作用于/list/my/join)
     *
     * @param userTeamList
     * @param teamList
     * @param loop
     */
    void joinUserNum(List<UserTeam> userTeamList, List<TeamUserVO> teamList, boolean loop);

    /**
     * 获取队伍列表
     *
     * @param teamListRequest
     * @param isAdmin
     * @param notShow
     * @return
     */
    List<TeamUserVO> listTeams(TeamListRequest teamListRequest, boolean isAdmin, List<Long> notShow);

    /**
     * 根据传入的类型查询创建或加入的队伍
     *
     * @param loginUser
     * @param userId
     * @param type
     * @return
     */
    List<TeamUserVO> listTeamsByType(UserVO loginUser, Long userId, int type);

}
